package day12;

import java.sql.Connection;

public class AnimalTest {
	public static void main(String[] args) {
		AnimalTest test = new AnimalTest();
		test.func(new Dog());
	}
	
	public void func(Animal animal){
		animal.eat();
		animal.shout();
	}
//	public void func(Dog dog){
//		dog.eat();
//		dog.shout();
//	}
//	public void func(Cat cat){
//		cat.eat();
//		cat.shout();
//	}
	
	
}

class Animal{
	public void eat() {
		System.out.println("动物，进食");
	}
	
	public void shout() {
		System.out.println("动物叫");
	}
}

class Dog extends Animal{
	
	@Override
	public void eat() {
		// TODO Auto-generated method stub
		System.out.println("狗吃骨头");
	}
	
	@Override
	public void shout() {
		System.out.println("汪汪汪");
	}
}

class Cat extends Animal{
	
	@Override
	public void eat() {
		// TODO Auto-generated method stub
		System.out.println("猫吃鱼");
	}
	
	@Override
	public void shout() {
		System.out.println("喵喵喵");
	}
}

// 举例二
class Order{
	public void method(Object obj) {
		
	}
}

// 举例三 
class Driver{
	public void doData(Connection conn){
		// 规范的步骤去操作数据
//		conn.method1();
//		conn.method2();
//		conn.method3();
		
	}
}